Notes on Abstract Syntax 15 - 312 : Foundations of Programming Languages
نویسنده
چکیده
Syntax L3.3 k nat num(k) expr t1 expr t2 expr plus(t1, t2) expr t1 expr t2 expr times(t1, t2) expr Now we specify the proper relation between concrete and abstract syntax through several simultaneously inductive judgments. Perhaps the easiest way to generate these judgments is to add the corresponding abstract syntax terms to each of the inference rules defining the concrete syntax. 0 D←→ 0 nat · · · 9 D←→ 9 nat s D←→ k nat s N←→ k nat s1 N←→ k1 nat s2 D←→ k2 nat s1 s2 N←→ 10k1 + k2 nat s T←→ t expr s E←→ t expr s1 E←→ t1 expr s2 T←→ t2 expr s1+s2 E←→ plus(t1, t2) expr s F←→ t expr s T←→ t expr s1 T←→ t1 expr s2 F←→ t2 expr s1*s2 T←→ times(t1, t2) expr s N←→ k nat s F←→ num(k) expr s E←→ t expr (s) F←→ t expr When giving a specification of the form above, we should verify that the basic properties we expect, actually hold. In this case we would like to check that related strings and terms belong to the correct (concrete or abstract, respectively) syntactic classes. Theorem 1 (i) If s E←→ t expr then s E and t expr. (ii) If s E then there exists a t such that s E←→ t expr. Proof: For each part, by rule induction on the given derivation. In each case we can immediately appeal to the induction hypothesis on all subderivations and construct a derivation of the desired judgment from the SUPPLEMENTARY NOTES SEPTEMBER 3, 2002 L3.4 Abstract Syntax
منابع مشابه
Lecture Notes on Futures 15-312: Foundations of Programming Languages
In this lecture we first examine a technique to specify the operational semantics for lazy evaluation. This is an implementation technique for a call-by-name semantics that avoids re-evaluating expressions multiple times by memoizing the result of the first evaluation. Then we use a similar technique to specify the meaning of futures, a construct that introduces parallelism into evaluation. Fut...
متن کاملNotes on Futures 15 - 312 : Foundations of Programming Languages
In this lecture we first examine a technique to specify the operational semantics for lazy evaluation. This is an implementation technique for a call-by-name semantics that avoids re-evaluating expressions multiple times by memoizing the result of the first evaluation. Then we use a similar technique to specify the meaning of futures, a construct that introduces parallelism into evaluation. Fut...
متن کاملP Lecture Notes on Semantics of Programming Languages for Part IB of the Computer Science Tripos
syntax tree of an command
متن کامل15–212: Fundamental Structures of Computer Science II Some Notes on Grammars and Parsing
These notes are intended as a “rough and ready” guide to grammars and parsing. The theoretical foundations required for a thorough treatment of the subject are developed in the Formal Languages, Automata, and Computability course. The construction of parsers for programming languages using more advanced techniques than are discussed here is considered in detail in the Compiler Construction course.
متن کاملImperative LF Meta-Programming
Logical frameworks have enjoyed wide adoption as meta-languages for describing deductive systems. While the techniques for representing object languages in logical frameworks are relatively well understood, languages and techniques for metaprogramming with them are much less so. This paper presents work in progress on a programming language called Rogue-Sigma-Pi (RSP), in which general programs...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2002